/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package specifications;

import java.util.ArrayList;

/**
 *
 * @author Jason
 */
public abstract class Parameter {
    private int priority;
    private String status = "incomplete"; //default status

    
    abstract public ArrayList<Directive> getDirectives();
    
    public void assignDirectivePriorities(){
        ArrayList<Directive> dirs = getDirectives();
        int div;
        try {
            div = priority / dirs.size(); // does this round up?
        } catch (ArithmeticException ex){
            return;
        }
        for (Directive d : dirs) {
            if (d.getPriority() == 0){
                d.setPriority(div);
            }
        }
    }
    
    public void computeParameterPriority(){
        assignDirectivePriorities();
        ArrayList<Directive> dirs = getDirectives();
        int totalPriority = 0;
        for (Directive d : dirs)
            totalPriority += d.getPriority();
        setPriority(totalPriority);
    }
    
    /**
     * @return the priority
     */
    public int getPriority() {
        return priority;
    }

    /**
     * @param priority the priority to set
     */
    public void setPriority(int priority) {
        this.priority = priority;
    }

    /**
     * @return the status
     */
    public String getStatus() {
        return status;
    }

    /**
     * @param status the status to set
     */
    public void setStatus(String status) {
        this.status = status;
    }
    
}
